#include "base.hpp"
#include "buffer_alloc.hpp"

namespace buffer
{
	BufferAlloc::BufferAlloc(FixedSizeAllocator & alloc)
		: _alloc(alloc)
	{
	}

	Buffer * BufferAlloc::allocate()
	{
		void * ptr = _alloc.allocate();
		return ((NULL == ptr)? NULL: new (ptr) Buffer(block_size()));
	}

	void BufferAlloc::deallocate(Buffer * buffer)
	{
		void * ptr = (void*) buffer;
		_alloc.deallocate(ptr);
	}
};

